public class Femo_FactoryClass {
}

class Point{
    //构造方法1 - 使用笛卡尔坐标系确定点的坐标
//    public Point(double x, double y){
//        //x表示横坐标，y表示纵坐标
//    }
    //构造方法2 - 使用极坐标系确定点的坐标
//    public Point(double r, double a){
//        //r表示半径，a表示角度
//    }
    private double x;//点的横坐标
    private double y;//点的纵坐标
    private double r;//点的半径
    private double a;//点的角度

    public void setX(double x) {
        this.x = x;
    }

    public void setY(double y) {
        this.y = y;
    }

    public void setR(double r) {
        this.r = r;
    }

    public void setA(double a) {
        this.a = a;
    }
}

class PointFactory{
    private double x;//点的横坐标
    private double y;//点的纵坐标
    public static Point createPointByXY(double x, double y){
        Point A = new Point();
        A.setX(x);
        A.setY(y);
        return A;
    }
    public static Point createPointByRA(double r, double a){
        Point B = new Point();
        B.setR(r);
        B.setA(a);
        return B;
    }
}

class TestPoint{
    public static void main(String[] args) {
        Point A = PointFactory.createPointByXY(2, 2);
        Point B = PointFactory.createPointByRA(2, 30);
    }
}
